<?php
/**
 * Created by PhpStorm.
 * User: baike
 * Date: 2017/12/6
 * Time: 下午3:25
 */
/**
 * Created by PhpStorm.
 * User: baike
 * Date: 2017/11/30
 * Time: 下午3:59
 */

include "../mysql_connect.php";
include "../common.php";



isset($_REQUEST['tm'])? $tm=$_REQUEST['tm']:$tm="";
isset($_REQUEST['sign'])? $sign=$_REQUEST['sign']:$sign="";
if( $tm=="" || $sign=="")
{
    die("need tm sign");
}

$arrparam=array();
$arrparam['tm']=$tm;
if(!signcheck($arrparam,$sign))
{
    die(makeresultjson(-1,"checksum fail"));
}

if(!signcheck_indb($sign))
{
    die(makeresultjson(-2,"checksum fail 2"));
}




$sql="select id,name,description from server;";
$rs=mysqli_query($_SESSION['mysqli_link'],$sql);
$arr_res=array();
$arr_res['return_code']=0;
$arr_res['data']=array();
while($arrrs=mysqli_fetch_assoc($rs))
{
    array_push( $arr_res['data'],$arrrs);
}
echo json_encode($arr_res,JSON_UNESCAPED_UNICODE);